package org.mca.mcaweb.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

@FacesConverter("convertToUpper")
public class ConvertToUpper implements Converter {

	public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
		if (value != null) {
			return value.toString().toUpperCase();
		} else {
			return null;
		}
	}

	public String getAsString(FacesContext facesContext, UIComponent component, Object value) {
		if (value != null && !"".equals(value)) {
			return value.toString().toUpperCase();
		} else {
			return "";
		}
	}
}